import BRAINICON from '@/assets/image/brainIcon.png';
import SPACEAVATAR from '@/assets/image/department-avatar.png';
import DEPARTMENTBTN from '@/assets/image/departmentBtn.png';
import { sllm_domains } from '@/services/ant-design-pro/departmentSpace.ts';
import { connect } from '@umijs/max';
import React, { useEffect, useState } from 'react';
import { history } from 'umi';
import '../index.less';
const NewSpaceBottomRight: React.FC = (props: any) => {
  const [domainList, setDomainList] = useState([]); //领域列表
  //跳转到部门知识空间
  const goUrl = () => {
    props.dispatch({
      type: 'spaceBot/updateStateAsync',
      payload: {
        curTab: 'department',
      },
    });
    history.push({
      pathname: `/departmentSpace?type=department&title=部门知识空间`,
    });
  };
  //查询全部领域
  const getsllmDomains = async () => {
    let res = await sllm_domains({});
    if (res.code === 0) {
      setDomainList(res.data);
    }
  };
  useEffect(() => {
    getsllmDomains();
  }, []);
  return (
    <div className="newSpaceBottomRight">
      <div className="newSpaceBottomRightTitle">
        <span className="spaceAvatar">
          <img className="" src={SPACEAVATAR} alt="" height={27} width={27} />
        </span>
        <span className="spaceTit">部门知识空间</span>
        <span className="spaceTitInfo">信息的持久储存和智能筛选</span>
      </div>
      <div className="departmentBox">
        <div className="departmentTitle">横琴部门知识训练中...</div>
        <div className="departmentTip">
          已经训练 <span className="departmentNum">{domainList[0]?.count}</span> 条数据{' '}
        </div>
        <div className="departmentButton" onClick={goUrl}>
          <img className="" src={DEPARTMENTBTN} alt="" height={27} width={27} />
        </div>
      </div>
      <div className="brainIcon">
        <img className="" src={BRAINICON} alt="" height={27} width={27} />
      </div>
    </div>
  );
};
// export default NewSpaceBottomRight;
export default connect(({ spaceBot }) => ({ spaceBot }))(NewSpaceBottomRight);
